local skel = fk.CreateSkill {
  name = "lb__yaoduan",
}

Fk:loadTranslationTable {
  ["lb__yaoduan"] = "摇缎",
  --[":lb__yaoduan"] = "出牌阶段开始时，你可以弃置/重铸任意张♣手牌，然后你令至多X名角色各摸X张牌/弃一张牌（X为弃置/重铸牌的类型数）。",
  --9.24
  [":lb__yaoduan"] = "出牌阶段开始时，你可以弃置/重铸任意张♣手牌，然后你令至多X名角色各摸X张牌/弃一张牌（X为弃置/重铸牌的牌数）。",

  ["$lb__yaoduan1"] = "万物，本质如一。",
  ["$lb__yaoduan2"] = "无论何时盛放…",
  ["$lb__yaoduan3"] = "生命，不仅存在于呼吸之间。",
}

skel:addEffect(fk.EventPhaseStart, {
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and player.phase == Player.Play and not player:isKongcheng()
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local s, ret = room:askToUseActiveSkill(player, {
      skill_name = "#lb__yaoduan_choose",
      prompt = "#lb__yaoduan",
    })
    if s and ret then
      event:setCostData(self, { cards = ret.cards, tos = ret.targets, choice = ret.interaction })
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    --local n = {}
    local cost_data = event:getCostData(self)
    local cards = cost_data.cards
    local choice = cost_data.choice
    local tos = cost_data.tos
    --[[
    table.forEach(cards,function (id)
      table.insertIfNeed(n,Fk:getCardById(id).type)
    end)
    --]]
    if choice == "discard" then
      room:throwCard(cards, skel.name, player, player)
    else
      room:recastCard(cards, player, skel.name)
    end
    room:sortByAction(tos)
    for _, p in ipairs(tos) do
      if choice == "discard" then
        --p:drawCards(#n,skel.name)
        p:drawCards(#cards, skel.name)
      else
        room:askToDiscard(p, {
          min_num = 1,
          max_num = 1,
          include_equip = true,
          skill_name = skel.name,
          cancelable = false,
        })
      end
    end
  end,
})

return skel
